# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-golang-freetype
pkgver=0.0.20170609
_commit=e2365dfdc4a05e4b8299a783240d4a7d5a65d4e4
pkgrel=3
pkgdesc='The Freetype font rasterizer in the Go programming language'
arch=('any')
url="https://github.com/golang/freetype"
license=('BSD' 'GPL2')
depends=('go' 'golang-golang-x-image')
source=("$pkgname-$_commit.tar.gz::https://github.com/golang/freetype/archive/$_commit.tar.gz")
sha512sums=('47f437a4d076cc6e72b295c3cc13bae66abc026b5f5961b17cae427acd285a006316adc44a48a2af5f8bdf1a787a0bc15a8c953664a5f65732868efbeabd8de9')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/golang
  cp -a "$srcdir"/freetype-$_commit "$srcdir"/build/src/github.com/golang/freetype
  cd "$srcdir"/build/src/github.com/golang/freetype
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/golang
  cp -a "$srcdir"/freetype-$_commit "$pkgdir"/usr/share/gocode/src/github.com/golang/freetype

  install -Dm644 freetype-$_commit/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
